package Collection;


import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

public class CollectionDemo4 {
    public static void main(String[] args) {
        Collection<Object> c1 = new HashSet<>();
        c1.add("ad");
        c1.add("ad");
        c1.add(new Point(1, 2));
        System.out.println(c1);

        Collection<String> c2 = new ArrayList<>();
        c2.add("adf");
        c2.add("qwe");
        c2.add("qwe");
        System.out.println(c2);

        /*
        boolean addAll(Collection c)
        当给定集合中的所有元素添加到当前集合中  当添加后当前集合发生了改变 则返回true
        */
        boolean b = c1.addAll(c2);
        System.out.println(b);
        System.out.println(c1);
        System.out.println(c2);

        /*
        boolean containsAll(Collection c)
        判断当前集合是否包含给定集合中的所有元素
         */
        boolean b1 = c1.containsAll(c2);
        System.out.println(b1);

        /*
        删除交集
         */
        c1.removeAll(c2);
        System.out.println(c1);
        System.out.println(c2);


    }


}
